package top.lingkang.potatoserver.config.exception;

import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import top.lingkang.potatoserver.constants.HttpConstants;
import top.lingkang.potatoserver.dto.ResponseResult;

/**
 * @author lingkang
 * @date 2021/9/19 0:26
 * @description
 */
@RestControllerAdvice
public class ControllerException {
    @ExceptionHandler(RuntimeException.class)
    public ResponseResult runtimeException(RuntimeException e) {
        return new ResponseResult(HttpConstants.FAIL, e.getMessage());
    }
}
